import request from '@/utils/request'

// 创建设备
export function createDevice(data) {
  return request({
    url: '/basic/device/create',
    method: 'post',
    data: data
  })
}

// 更新设备
export function updateDevice(data) {
  return request({
    url: '/basic/device/update',
    method: 'put',
    data: data
  })
}

// 删除设备
export function deleteDevice(id) {
  return request({
    url: '/basic/device/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除设备 */
export function deleteDeviceList(ids) {
  return request({
    url: `/basic/device/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得设备
export function getDevice(id) {
  return request({
    url: '/basic/device/get?id=' + id,
    method: 'get'
  })
}

// 获得设备分页
export function getDevicePage(params) {
  return request({
    url: '/basic/device/page',
    method: 'get',
    params
  })
}
// 导出设备 Excel
export function exportDeviceExcel(params) {
  return request({
    url: '/basic/device/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}